import React from 'react';
import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
import { Provider } from 'react-redux';
import { ConfigProvider } from 'antd';
import zhCN from 'antd/locale/zh_CN';
import { store } from './store';
import Layout from './components/Layout/Layout';
import FlightList from './components/Flight/FlightList';
import FlightForm from './components/Flight/FlightForm';
import PassengerList from './components/Passenger/PassengerList';
import PassengerForm from './components/Passenger/PassengerForm';
import BookingList from './components/Booking/BookingList';
import BookingCreate from './components/Booking/BookingCreate';
import BookingDetail from './components/Booking/BookingDetail';
import Dashboard from './components/Dashboard/Dashboard';
import Reports from './components/Reports/Reports';
import './App.css';

function App() {
  return (
    <Provider store={store}>
      <ConfigProvider locale={zhCN}>
        <Router>
          <Layout>
            <Routes>
              <Route path="/" element={<Navigate to="/dashboard" replace />} />
              <Route path="/dashboard" element={<Dashboard />} />
              
              {/* 航班管理 */}
              <Route path="/flights" element={<FlightList />} />
              <Route path="/flights/create" element={<FlightForm />} />
              <Route path="/flights/edit/:id" element={<FlightForm />} />
              
              {/* 乘客管理 */}
              <Route path="/passengers" element={<PassengerList />} />
              <Route path="/passengers/create" element={<PassengerForm />} />
              <Route path="/passengers/edit/:id" element={<PassengerForm />} />
              
              {/* 预订管理 */}
              <Route path="/bookings" element={<BookingList />} />
              <Route path="/bookings/create" element={<BookingCreate />} />
              <Route path="/bookings/:bookingNumber" element={<BookingDetail />} />
              <Route path="/passengers/:passengerId/bookings" element={<BookingList />} />
              
              {/* 报表 */}
              <Route path="/reports" element={<Reports />} />
            </Routes>
          </Layout>
        </Router>
      </ConfigProvider>
    </Provider>
  );
}

export default App;